Generally, there is a state known as deadlock as an abnormal operation in the microcomputer. During deadlock, prime oscillation is stopped unexpectedly and the operation mode shifted from run to stop due to the generation of broken data in some latch circuits. The broken data is generated because of sudden changes in supply voltage or influence of external noise etc. The CPU has no control on the occurrence of the deadlock. One-chip microcomputer are used in vehicles for controlling electronic equipment. It is very important to provide a fail safe function in such microcomputers to prevent generation of a deadlock.
Conventionally, there is known an external reset function to realize the fail safe function. In this external reset function, a reset signal is input into a reset terminal of the microcomputer from outside and the CPU is reset to initial state. There is also know an external interrupt function or non-maskable interrupt (NMI) function to realize the fail safe function. In this external interrupt function or non-maskable interrupt (NMI) function, an interrupt requesting signal is input into an external interrupt (INT) terminal or a non-maskable terminal of the microcomputer from outside. As a consequence, an interrupt occurs, and an interrupt processing is executed.
However, in the external reset function, since internal register value is initialized because of the reset, there is a problem that the data is lost. There maybe thought of a method that does not -initialize the needful resources even if the reset signal is input. However, such method is not practical because needful resources that should not be initialized differ depending upon how and where the microcomputer is being used.
Moreover, in the external interrupt function, only when it is transited to state of stop after permission of external interrupt is set by software, state of stop is released by means of input of the interrupt requesting signal. Therefore, when it is transited to state of stop before setting of permission of interrupt, state of stop cannot be released. In addition, in the non-maskable interrupt function, there is a problem that since interrupt processing is executed unconditionally in not only state of stop but also normal state of run, unnecessary code is executed by execution of interrupt processing in normal state of run.